<template>
	<view class="listCard" :class="showBack?'showBackd':''" @click="look">
		<!-- 无图展示 -->
		<view v-if="mode==='none'" class="basicsView noneView">
			<view class="infoContene">
				<view class="inforTitle">
				<text>{{data.title}}</text>
				<like :item ="data"></like>
				</view>
				<view class="setView">
					<text class="setLabel">{{data.classify}}</text>
					<text class="settime">{{data.create_time}}</text>
				</view>
			</view>
		</view>
		<!-- 基础视图 -->
		<view v-if="mode==='base'" class="basicsView">
			<view class="imageView">
				<image :src="data.cover[0]" mode=""></image>
			</view>
			<view class="infoContene">
				<view class="inforTitle">
				<text>{{data.title}}</text>
				<like :item ="data"></like>
				</view>
				<view class="setView">
					<text class="setLabel">{{data.classify}}</text>
					<text class="settime">{{data.create_time}}</text>
				</view>
			</view>
		</view>
		<!-- 多图视图 -->
		<view v-if="mode==='image'" class="basicsView mode-image">
			<view class="infoContene">
				<view class="inforTitle">
					<text>{{data.title}}</text>
					<like :item ="data"></like>
				</view>
				<view class="imageView">
					<view class="image-content" v-for="item in 4" :key="item">
						<image :src="data.cover[item]" mode=""></image>
					</view>
				</view>
				<view class="setView">
					<text class="setLabel">{{data.classify}}</text>
					<text class="settime">{{data.create_time}}</text>
				</view>
			</view>
		</view>
		<!-- 大图视图 -->
		<view v-if="mode==='column'" class="basicsView big-image">
			<view class="infoContene">
				<view class="inforTitle">
					<text>{{data.title}}</text>
					<like :item ="data"></like>
				</view>
				<view class="imageView">
					<view class="image-content" >
						<image :src="data.cover[0]" mode=""></image>
					</view>
				</view>
				<view class="setView">
					<text class="setLabel">{{data.classify}}</text>
					<text class="settime">{{data.create_time}}</text>
				</view>
			</view>
		</view>
		<!-- 展示图 -->
		<view v-if="showBack" class="basicsView templates">
			<view class="showBack-centon">
				<view class="image-cont">
					<image :src="data.avatar" mode=""></image>
				</view>
				<view class="showBack-centon-title inforTitle">
					<text>{{data.title}}</text>
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lock: '125',
				// loading:'loading_1/loading_1'
			};
		},
		props:{
			mode:{
				type:String,
				default: '',
			},
			data:{
				type:Object,
				default: {},
			},
			showBack:{
				type:Boolean,
				default: false,
			}
		},
		created() {
			// console.log(this.data,this.showBack,'datadatadata');
		},
		methods:{
			look(){
				if(this.showBack){
					console.log("dasdsdffsdf");
					// this. = this.data.loading
					uni.navigateTo({
						// url:'../../../../'
						url:'/templates/' + this.data.path +"?title="+ this.data.title,
						animationType: 'pop-in',
						animationDuration: 1000
					})
				} else{
					// console.log(this.data,"点击卡片了");
					const data = this.data;
					let params = {
						classify: data.classify,
						create_time: data.create_time,
						is_like: data.is_like,
						title: data.title,
						comments_count: data.comments_count,
						author:{avatar: data.author.avatar},
						_id:data._id
					}
					// console.log(params,"点击卡片了");
					uni.navigateTo({
						url:'/pages/views/Classify_detail/Classify_detail?params=' + JSON.stringify(params)
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.showBackd{
		width: 33.33%;
		box-sizing: border-box;
		padding-right: 15px;
		padding-top: 15px;
	}
	.listCard {
		box-sizing: border-box;
		.basicsView {
			padding: 10px;
			margin: 10px;
			border-bottom: 1px solid rgba($color: #000000, $alpha: 0.05);
			display: flex;
			box-sizing: border-box;

			.imageView {
				height: 100px;
				width: 60px;
				flex-shrink: 0;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.infoContene {
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				font-size: 11px;
				padding-left: 15px;

				width: 100%;

				.inforTitle {
					font-size: 16px;
					position: relative;
					color: #333;
					font-weight: 400;
					line-height: 1.2;
					padding-right: 25px;
					text {
						// 俩行超出溢出
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
					}
				}

				.setView {
					width: 100%;
					display: flex;
					justify-content: space-between;
					.setLabel {
						border-radius: 15px;
						padding: 0 5px;
						// border: 1px solid $my-bg-color;
						background-color:#dddddd;
						color:#fff;
						line-height: 1.5;
					}

					.settime {
						color: #999;
					}

				}
			}
		}
		.mode-image {
			.infoContene {
				padding: 0;
				.inforTitle{}
				.imageView{
					display: flex;
					flex-direction: row;
					width: 100%;
					margin: 5px 0;
					.image-content{
						width: 100%;
						height: 100%;
						padding: 2px;
						box-sizing: border-box;
					}
				}
			}
		}
		.big-image {
			.infoContene {
				padding: 0;
				.inforTitle{}
				.imageView{
					overflow: hidden;
					width: 100%;
					display: flex;
					align-items: center;
					margin: 5px 0;
					// margin: 5px 0;
					.image-content{
						width: 100%;
						height: 300%;
						padding: 2px;
						box-sizing: border-box;
					}
				}
			}
		}
		.templates{
			// background-color: #0000FF;
			// height: 100px;
			width: 100%;
			padding: 0;
			padding-top: 180%;
			height: 0;
			margin: 0;
			margin-right: 15px !important;
			position: relative;
			box-sizing: border-box;
			.showBack-centon{
					box-sizing: border-box;
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				display: flex;
				flex-direction: column;
				// background: #00FF00;
				.image-cont{
					width: 100%;
					flex: 1;
		
					image{
						width: 100%;
						height: 100%;
					}
				}
				.inforTitle {
					font-size: 16px;
					position: relative;
					color: #333;
					font-weight: 400;
					line-height: 1.2;
					// padding-right: 25px;
					text {
						// 俩行超出溢出
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
					}
				}
				.showBack-centon-title{
					box-sizing: border-box;
					margin-top: 5px;
					height: 33px;
					font-size: 14px;
					font-weight: bold;
					color: #ccc;
				}
			}
		}
		.noneView{
			.setView{
				margin-top: 5px;
			}
			.infoContene{
				padding-left: 0;
			}
		}
	}
</style>
